<%@ page language="java"   pageEncoding="utf-8"%>
 <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML>
<html>
  <head>
    <base href="${pageContext.request.contextPath}/">
    
    <title>My JSP 'news.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
	 #cate li{float:left;width:60px; list-style:none;}
	 #cate:after{clear:both;display:block;height:0;content:''}
	</style>
	<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
	<script type="text/javascript">
	 $(function(){
		 var cate=$("#cate");
		 $.get("cate/list",function(data){
			 $.each(data,function(i,d){
				 cate.append("<li><a href='news/1-"+d.id+"'>"+d.catename+"</a></li>");
			 });
		 });
	 });
	</script>
  </head>
  
  <body>
    <ul id="cate">
    
    </ul>
    <h1>新闻列表</h1>
    <a href="news/toAdd">增加新闻</a>
    <ul>
      <c:forEach var="n" items="${p.list}">
      	<li><a href="news/show/${n.id}"><c:out value="${n.title}"/></a>,${n.pub_date}<a href="news/del/${n.id}">删除</a></li>
      </c:forEach>
      <li>
       <a href="news/${p.pageNumber-1}-${cid}">上一页</a>&nbsp;<a href="news/${p.pageNumber+1}-${cid}">下一页</a>&nbsp;<a href="news/${p.totalPage}-${cid}">最后一页</a>
      </li>
    </ul>
  </body>
</html>
